package com.yc.test.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.NotBlank;

@Data
@ApiModel("数据字典")
@Document(collection = "BopDict")
public class BopDict extends BasePO {
    @ApiModelProperty("字典编码")
    @NotBlank(message = "字典编码不能为空")
    private String code;
    @ApiModelProperty("字典名称")
    @NotBlank(message = "字典名称不能为空")
    @Length(max = 20, min = 1, message = "长度必须在1-20之间")
    private String nameCn;
    @ApiModelProperty("字典名称")
    @NotBlank(message = "字典名称不能为空")
    @Length(max = 20, min = 1, message = "长度必须在1-20之间")
    private String nameEn;
    @ApiModelProperty("字典名称")
    @NotBlank(message = "字典名称不能为空")
    @Length(max = 20, min = 1, message = "长度必须在1-20之间")
    private String nameTw;

    @ApiModelProperty("上级ID")
    private String parentId;
    @ApiModelProperty("祖编码")
    private String baseCode;

    public BopDict() {
    }

    @Transient
    @ApiModelProperty("字典名称")
    private String name;
    @Transient
    @ApiModelProperty("上级ID")
    private String parentName;


    public BopDict(String code, String nameCn, String nameEn, String nameTw, String parentId
            , String baseCode) {
        this.code = code;
        this.nameCn = nameCn;
        this.nameEn = nameEn;
        this.nameTw = nameTw;
        this.parentId = parentId;
        this.baseCode = baseCode;
    }
}
